#ifndef __VSDL_IMAGE_H__
#define __VSDL_IMAGE_H__

#include <SDL/SDL.h>
#include <SDL/sprig.h>
#include "VSDL_point.h"
#include "VSDL_RGB.h"
#include "VSDL_clip.h" 

class VSDL_Image{
protected:
	//Coordinates in image
	VSDL_Point clipXY;
	int clipWidth;
	int clipHeight;
	//Color
	VSDL_RGB rgb;
	unsigned int colorkey;
	//Alpha
	int alpha;
	int lastAlpha;
	//Size of image
	int actualWidth;
	int actualHeight;
	//Surfaces
	SDL_Surface *imageSurf; //Original surface
	int imageFlag;
public:
	//Constructors
	VSDL_Image();
	VSDL_Image(const char *imageFileName);
	VSDL_Image(const char *imageFileName, VSDL_RGB colorkey);
	VSDL_Image(const char *imageFileName, unsigned char colorkeyR, unsigned char colorkeyG, unsigned char colorkeyB);
	//Destructor
	~VSDL_Image();
	//Image loading
#define LoadImageA LoadImage
	int LoadImage(const char *imageFileName);
	int LoadImage(const char *imageFileName, VSDL_RGB colorkey);
	int LoadImage(const char *imageFileName, unsigned char colorkeyR, unsigned char colorkeyG, unsigned char colorKeyB);
	int ReloadImage(const char *imageFileName);
	int ReloadImage(const char *imageFileName, VSDL_RGB colorkey);
	int ReloadImage(const char *imageFileName, unsigned char colorkeyR, unsigned char colorkeyG, unsigned char colorKeyB);
	//Color key setting
	int SetColorkey(VSDL_RGB colorkey);
	int SetColorkey(unsigned char r, unsigned char g, unsigned char b);
	//Alpha
	void SetAlpha(int alpha);
	//Bliting
	int Blit(SDL_Surface *destSurf, int destX, int destY);
	int Blit(SDL_Surface *destSurf, VSDL_Point destXY);
	int BlitRect(SDL_Surface *destSurf, SDL_Rect imageRect, int destX, int destY);
	virtual int BlitClip(SDL_Surface *destSurf, VSDL_Clip srcClip, int destX, int destY);
	virtual int BlitClip(SDL_Surface *destSurf, VSDL_Clip srcClip, VSDL_Point destXY);
	//Properties retrieving
	int GetImageWidth();
	int GetImageHeight();
	int GetActualSize(int *imageWidth, int *imageHeight);
	int GetColorkey(VSDL_RGB &colorkey);
	int GetColorkey(unsigned char *r, unsigned char *g, unsigned char *b);
	int GetAlpha();
};

#endif /*__VSDL_IMAGE_H__*/
